#include "MyController.h"

namespace PeanutQuest {

	MyController::MyController() : cg::Entity("Controller") {
	}
	MyController::~MyController() {
	}

	void MyController::init() {
		// Para mudar nivel
		gameManager = (GameManager*)cg::Registry::instance()->get("GameManager");
		cameraManager = (CameraManager*)cg::Registry::instance()->get("CameraManager");
		shooter = (ShooterManager*)cg::Registry::instance()->get("ShooterManager");
	}

	void MyController::onKeyPressed(unsigned char key) {

		//ESC
		if(key == 27) {
			cg::Manager::instance()->shutdownApp();
        }

		// load level 1
		if(key == 49 && gameManager->getLevel() == 0) {
			gameManager->LoadLevel1();
		}
		//load level 2
		if(key == 50 && gameManager->getLevel() == 0) {
			gameManager->LoadLevel2();
		}
		// go to menu
		if(key == 48 && gameManager->getLevel() != 0) {
			gameManager->LoadGameMenu();
		} 

		// first person camera
		if(key == 49 && gameManager->getLevel() != 0) {
			cameraManager->changeCamera_to_FirstCamera();
		}
		// third person camera
		if(key == 51 && gameManager->getLevel() != 0) {
			cameraManager->changeCamera_to_ThirdCamera();
		}
		// debug camera
		if (key == 57 && gameManager->getLevel() != 0) {
			cameraManager->changeCamera_to_DebugCamera();
		}
	}

	void MyController::onKeyReleased(unsigned char key) {
	}

	void MyController::onSpecialKeyPressed(int key) {

	}

	void MyController::onSpecialKeyReleased(int key) {
	}

}